<template>
  <div>
    <form action="">
      <input type="text" v-model="form.username" />
      <input type="text" v-model="form.password" />
      <button type="button" @click="fn">提交</button>
    </form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      //把将来要准备放到axios的data中提前准备好一个对象
      form: {
        username: "",
        password: "",
      },
    };
  },
  methods: {
    fn() {
      console.log(this.form);
    },
  },
};
</script>

<style scoped></style>
